package cn.mazexal.exambg.common.models;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author: Mazexal
 * Date: 2025/5/11
 */
public class UserContext {
    private static final ThreadLocal<User> credentials = new ThreadLocal<>();

    public static void set(User auth) {
        credentials.set(auth);
    }

    public static User get() {
        return credentials.get();
    }

    public static void clear() {
        credentials.remove();
    }

    @Getter
    @AllArgsConstructor
    public static class User {
        private long userId;
    }
}
